function changeCode() {
    //http访问后台时，如果地址一样，则直接从缓存里面取数据
    $(".name-img").attr("src", "http://localhost:8080/code?aa=" + Math.random());
}

function login() {

    let data = {
        username: $("#username").val(),
        password: $("#password").val(),
        code: $("#code").val()
    };
    let result = myAjax("/login", data, "post");
    if (result.result == 'success') {
        sessionStorage.setItem("username", $("#username").val());
        window.open("manage.html");
        // location.href='manage.html'
    }
    if (result.result == 'error-code') {
        alert("验证码错误，请重新输入");
    }
    if (result.result == 'error') {
        alert("用户名或者密码错误，请重新输入");
    }
}